<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>状态页</title>
</head>
<body>
    <h1 id="h1">注册成功</h1>
    <h2 id="h2">3秒后回到首页</h2>
    <script>
        let state = sessionStorage.state;
        if(state == "注册成功"){
            h1.innerHTML = state;
            h1.style.color = "green";
        }else{
            h1.innerHTML = state;
            h1.style.color = "red";
        }
        function f1(){
            let j = parseInt(h2.innerHTML);
            setInterval(() => {
                j--;
                h2.innerHTML = j + "秒后回到首页";
                j == 0 &&(location = "../index.html");
            }, 1000);
        }
        f1();
    </script>
</body>
</html>